package model;

import java.awt.Color;
import java.awt.Graphics;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class Coin extends GameObject
{
        protected boolean visible;
        protected int FLAG; // positive values are power-ups, negative values are penalties
        
        protected final int DUR = 10000;
        
        public Coin()
        {
                super();
                color = Color.BLUE;
                FLAG = 0; // indicates that this coin has not attained its type yet
                visible = true;
        }
        
        public Coin(String filename)
        {
                super();
                color = Color.BLUE;
                FLAG = 0; // indicates that this coin has not attained its type yet
                visible = true;
                
                try{
                        image = ImageIO.read(new File(filename));
                } catch(IOException e){ 
                }
        }
        
        public Coin(Coin coin)
        {
                super();
                color = coin.getColor();
                FLAG = coin.getType(); // indicates that this coin has not attained its type yet
                visible = coin.getVisibility();
                
                this.filename = coin.getFilename();
                
                try{
                        image = ImageIO.read(new File(filename));
                } catch(IOException e){ 
                }
        }
        
        public int getType()
        {
                return FLAG;
        }
        
        public void setVisibility(boolean b)
        {
                visible = b;
        }
        
        public boolean getVisibility()
        {
                return visible;
        }
        
        public void draw(Graphics page)
        {
                if(visible)
                        page.drawImage(image, (int)getX(), (int)getY(), null);
        }
        
        public void update()
        {
                
        }

}